package com.bootdo.screen.controller;

import com.bootdo.screen.domain.*;
import com.bootdo.screen.service.*;
import com.bootdo.screen.service.impl.EnergyDataServiceImpl;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.*;

import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.http.ResponseEntity.ok;

@CrossOrigin
@Controller
@RequestMapping(path = "energyscreen")
public class EnergyDataController {
    @Autowired
    private EnergyDataServiceImpl energyDataService;

//    @RequestMapping(path = "get", method = GET)
//    public ResponseEntity<?> getEnergyData(){
//        return  ok(energyDataService.getEnergyData());
//    }

    @ResponseBody
    @RequestMapping(path = "getDataClasses", method = GET)
    public Map<String,Object> getDataClasses() {
        return energyDataService.getDataClasses();
    }

    @ResponseBody
    @RequestMapping(path = "getHotWordCount", method = GET)
    public List<Map<String,Object>> getHotWordCount() {
        return  energyDataService.getHotWordCount(100);
    }

    @ResponseBody
    @RequestMapping(path = "getHotWordCountByNum/{num}", method = GET)
    public List<Map<String,Object>> getHotWordCountByNum(@PathVariable("num") Integer num) {
        return  energyDataService.getHotWordCount(num);
    }

    @ResponseBody
    @RequestMapping(path = "getTypeCount", method = GET)
    public List<Map<String,Object>> getTypeCount() {
        return energyDataService.getTypeCount();
    }



    @ResponseBody
    @RequestMapping(path = "getBusinessCount", method = GET)
    public List<Map<String,Object>> getBusinessCount() {
        return energyDataService.getBusinessCount();
    }


    @ResponseBody
    @RequestMapping(path = "getEnergyTotal", method = GET)
   public  Long getEnergyTotal() {
        return energyDataService.getEnergyTotal();
   }

    @ResponseBody
    @RequestMapping(path = "getSourceCount", method = GET)
    public List<Map<String,Object>> getSourceCount() {
        return energyDataService.getSourceCount();
    }

    @ResponseBody
    @RequestMapping(path = "getAreaCount", method = GET)
    public Map<String,Object> getAreaCount() {
        return energyDataService.getAreaCount();
    }

}
